package com.bwie.controller;

import com.bwie.service.UserService;
import com.bwie.utils.R;
import com.bwie.vo.LoginInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author GaoYiJie
 * @Description
 * @Create 2025/2/27 9:12
 * @Version 1.0
 */
@RestController
@RequestMapping("/user/user")
public class UserController {

    @Autowired
    UserService userService;

    /**
     * 登录
     * @param loginInfoVo
     * @return
     */
    @PostMapping("/login")
    public R login(@RequestBody LoginInfoVo loginInfoVo){
        return userService.login(loginInfoVo);
    }


    /**
     * 根据ID获取用户
     * @param userId
     * @return
     */
    @PostMapping("/getUserById/{userId}")
    public R getUserById(@PathVariable("userId") Integer userId){
        return userService.getUserById(userId);
    }
}
